﻿using UnityEngine;
using System.Collections;

public class Consumables : BuffItem {
	private Vital[] _vital;					//a list of vitals to heal
	private int[] _amountToHeal;			//the amount to heal each vital

	private float _buffTime; 				// How long the buff last if there is one

	public Consumables(){
		Reset ();
	}

	public Consumables(Vital[] v, int[] a, float b){
		_vital = v;
		_amountToHeal = a;
		_buffTime = b;
	}
	public void Reset(){
		_buffTime = 0;

		for(int count = 0; count <_vital.Length; count++)
		{
			_vital[count] = new Vital();
			_amountToHeal[count] = 0;
		}

	}

	public int VitalCount(){
		return _vital.Length;
	}
	public Vital VitalAtIndex(int index){
		if(index < _vital.Length + 1 && index > -1)
			return _vital [index];
		else 
			return new Vital();
	}
	public int HealAtIndex(int index){
		if(index < _amountToHeal.Length + 1 && index > -1)
			return _amountToHeal [index];
		else 
			return 0;
	}

	public void SetVitalAt(int index, Vital vital){
		if (index < _vital.Length + 1 && index > -1)
			_vital [index] = vital;
	}
	public void SetHealAt(int index, int heal){
		if (index < _amountToHeal.Length + 1 && index > -1)
			_amountToHeal [index] = heal;
	}

	public void SetVitalAndHealAt(int index, Vital vital, int heal){
		SetVitalAt (index, vital);
		SetHealAt (index, heal);
	}
	public float BuffTime{
		get{ return _buffTime;}
		set{ _buffTime = value;}
	}
}
